package com.jr.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/main")
public class MainController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("客户发送的请求达到doGet()进行处理");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("客户发送的请求达到doPost()进行处理");
    }


    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("客户发送请求达到 service方法，进行分发！");
        super.service(req, resp);
    }

    public MainController(){
        System.out.println("MainController 类对象 进行 销毁");
    }

    @Override
    public void destroy() {
        System.out.println("MainController 类对象 进行 实例化");
    }

    @Override
    public void init() throws ServletException {
    }

}
